package com.sky.context;

/**
 * 使用ThreadLocal来存储id
 */
public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();


    //设置局部变量的值
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }


    //得到局部变量的值
    public static Long getCurrentId() {
        return threadLocal.get();
    }


    // 移除当前线程的局部变量
    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
